<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<c:import url="/head.jsp"></c:import>
<script
	src="<%=request.getContextPath()%>/scripts/My97DatePicker4/WdatePicker.js"></script>
<c:import url="/deptselectInner.jsp"></c:import>
<script src="<%=request.getContextPath()%>/scripts/jquery.form.js"></script>
<script src="<%=request.getContextPath()%>/scripts/submitcheck.js"></script>
<script type="text/javascript">

String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
};

function bopt( k ){
	$("#opt").val(k) ;
}
var f = null;

function check(formData, jqForm, options) {
	if (f.comPublishDepart.value == ""){
		alert("必须选择信用信息发布管理部门");
		return false;
	}
	
	if (f.companyName.value == ""){
		alert("必须填写企业名称");
		f.companyName.focus();
		return false;
	}
	f.companyCode.value = f.companyCode.value.replace('-','');
	if ((f.companyCode.value.length>11) || (f.companyCode.value.length<8)){
		alert("请输入完整组织机构代码");
		f.companyCode.focus();
		return false;
	}
	if (f.opt.value=='3'){
		f.rejectReason.value = f.rejectReason.value.trim();
		if (f.rejectReason.value == ''){
			f.rejectReason.focus();
			alert("审核未通过时必须填写审核未通过意见");
			return false;
		}
	}
	
	if(f.comPublishDepart.value.substring(8,9)<2){
		alert(f.comPublishDepartShow.value+"不能选做审批部门，请选择具体的审批部门");
		return false;
	}
	
	return true;
}

</script>
<body leftmargin="0" rightmargin="0" topmargin="0">

<form id="form1" name="form1" method="post"
	action="<c:url value="/admin/saveCompanyInfo/"/>" onsubmit="return false">

<%@include file="orgform.jsp"%>

<table align="center" width="100%" id="optbtn">
	<tr>
		<td align="center"><input type="hidden" id="opt" name="opt"
			value="1" /><input type="hidden" name="proCode" value="${proCode}" />

		<c:if test="${show == 1}">
			<input type="submit" value="保  存" onclick="bopt(1)" class="bnt60" />
		</c:if></td>
	</tr>
</table>
<input type="hidden" id="newId" name="comId"
	value="${companyBaseInfo.comID}" /></form>
<script type="text/javascript">

window.onload=function (){

	f = document.getElementById("form1");

	var options={type:"POST", dataType:"json", beforeSubmit:check, success:resultResponse};
	$('#form1').ajaxForm(options);
}

</script>
</body>
</html>
